package com.momo.common.res.authority;

import com.momo.mapper.dataobject.RoleDO;
import lombok.*;

/**
 * Created by Kagome on 2019/4/20.
 */
@Getter
@Setter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AllRolesRes {

    private Long id;
    /**
     * sysRoleName 角色名称.
     */
    private String sysRoleName;
    private String initRoleName;
    /**
     * sysRoleType 角色的类型，0：管理员角色，1：普通用户 2其他.
     */
    private String sysRoleType;
    /**
     * sysRoleStatus 是否被禁用
     */
    private boolean disabled;
    // 是否要默认选中
    private boolean checked = false;

    public static AllRolesRes roleDoTOAllRolesRes(RoleDO roleDO) {
        AllRolesRes allRolesRes = new AllRolesRes();
        if ("0".equals(roleDO.getSysRoleType())) {
            allRolesRes.setSysRoleName(roleDO.getSysRoleName() + "-" + "管理员");
        } else {
            allRolesRes.setSysRoleName(roleDO.getSysRoleName());
        }
        if ("1".equals(roleDO.getSysRoleStatus())) {
            allRolesRes.setDisabled(true);
        }
        allRolesRes.setId(roleDO.getId());
        allRolesRes.setSysRoleName(roleDO.getSysRoleName());
        return allRolesRes;
    }
}
